package org.bai.meetingfilm.common.vo;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * @ClassName BasePageRepVO
 * @Description 返回数据分页封装VO
 * @Author bai
 * @Date 2021/7/18 19:17
 * @Version 1.0
 **/
public class BasePageRepVO<M> {

    /**
     * @description: 数据总条数
     */
    private Long totalSize;

    /**
     * @description: 数据总分页数
     */
    private Long totalPages;

    /**
     * @description: 每页数据条数
     */
    private Long pageSize;

    /**
     * @description: 当前页
     */
    private Long nowPage;

    /**
     * @description: 返回数据
     */
    private List<M> list;

    public Long getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(Long totalSize) {
        this.totalSize = totalSize;
    }

    public Long getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(Long totalPages) {
        this.totalPages = totalPages;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public Long getNowPage() {
        return nowPage;
    }

    public void setNowPage(Long nowPage) {
        this.nowPage = nowPage;
    }

    public List<M> getList() {
        return list;
    }

    public void setList(List<M> list) {
        this.list = list;
    }

    public BasePageRepVO() {
    }

    public BasePageRepVO(Long totalSize, Long totalPages, Long pageSize, Long nowPage, List<M> list) {
        this.totalSize = totalSize;
        this.totalPages = totalPages;
        this.pageSize = pageSize;
        this.nowPage = nowPage;
        this.list = list;
    }

    public static<M> BasePageRepVO<M> buildDefaultPage() {
        BasePageRepVO<M> pageRepVO = new BasePageRepVO<>();
        pageRepVO.setTotalSize(0L);
        pageRepVO.setTotalPages(0L);
        pageRepVO.setPageSize(10L);
        pageRepVO.setNowPage(1L);
        pageRepVO.setList(Lists.newArrayList());
        return pageRepVO;
    }
}
